package router

import (
	"github.com/gin-gonic/gin"
	"honeyweb/controller"
	"honeyweb/middleware"
)

func InitRouter() *gin.Engine{
	rt := gin.Default()

	rt.GET("/ping", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message": "pong",
		})
	})

	api := rt.Group("/api")
	api.Use(middleware.Cors())

	//登陆
	controller.RegisterLoginRoute(api)

	//排行
	controller.RegisterRankRoute(api)

	return rt
}
